# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=sqlint
_gemname=sqlint
pkgver=0.3.0
# See https://github.com/purcell/sqlint/issues/30
_gitrev=b832cf7edd72585575e1278d506cd49ec5ba2ed8
pkgrel=0
pkgdesc="Simple SQL linter supporting ANSI and PostgreSQL syntaxes"
url="https://github.com/purcell/sqlint"
# x86, armhf, armv7, s390x and riscv64 blocked by ruby-pg_query
arch="noarch !x86 !armhf !armv7 !s390x !riscv64"
license="MIT"
depends="ruby ruby-pg_query"
checkdepends="ruby-rspec"
makedepends="ruby-dev"
source="https://github.com/purcell/sqlint/archive/$_gitrev/sqlint-$_gitrev.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$pkgname-$_gitrev"

build() {
	gem build $_gemname.gemspec
}

check() {
	rspec
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--bindir "$pkgdir/usr/bin" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Clean-up...
	rm -r "$gemdir"/cache \
		"$gemdir"/build_info \
		"$gemdir"/doc \
		"$gemdir"/extensions
}

sha512sums="
f4056fb95093539521719327f8bf73f57c91602fca54bfc950a0ed36fe8e1691b28c5ce75a363dc6efcdb09583782c410d826c4cbffac26c394af1eab4111c1c  sqlint-b832cf7edd72585575e1278d506cd49ec5ba2ed8.tar.gz
ebe98a70c188095847b7e6bd374ac50ae0972a9c2ea970b58478db1715c5ae4db1631f65405a3fc1ab07c3bef3b9a1f9a152c36a22e55ce57a91d93a81226aca  gemspec.patch
"
